<?php
if (isset($notifications)) {
    foreach ($notifications as $notification) {
        ?>
        <div data-id='<?php echo $notification['id']; ?>' data-read='<?php echo $notification['read']; ?>' class="media notification-item list-group-item <?php echo $notification['read'] == 0 ? 'unread bg-light hover lter' : 'read bg-white hoverr'; ?>" 
             data-notification-dt="<?php echo $notification['created']; ?>" data-type-id="<?php echo $notification['notification_type_id']; ?>">
                 <!--<span class="pull-left thumb-sm">
                     <img src="images/avatar.jpg" alt="John said" class="img-circle">
                 </span>-->
            <span class="media-body block m-b-none">

                <div class='row-fluid'>
                    <div class='col-sm-11 text-xs'>
                        <div class='row-fluid'>
                            <a href='<?php echo $this->Html->url($notification['url']); ?>'>
                                <span class='col-sm-1 text-left' style='padding-left: 4px; padding-right: 4px;'>
                                    <i class='fa fa-calendar fa-2x'></i> 
                                </span>
                                <span class='col-sm-11' style='padding-left: 4px; padding-right: 4px;'>
                                    <div class='text-sm'><?php echo $notification['message']; ?></div>
                                    <div class='text-xs time_ago'><?php echo $this->Time->timeAgoInWords($notification['created']); ?></div>
                                </span>
                            </a>
                        </div>
                    </div>
                    <div class='col-sm-1 text-xs'>
                        <a class='mark_read' href='<?php echo $this->Html->url(array('controller' => 'organisation', 'action' => 'notifications', 'mark_read', $notification['notification_type_id'], $notification['id'])); ?>' class='text-info' title='Mark Read/Unread'>
                            <i class='fa fa-circle'></i>
                        </a>
                    </div>
                </div>
            </span>
        </div>
        <?php
    }
}
?>

<input type="hidden" id="latest_notifications_url" value="<?php echo $this->Html->url(array('controller' => 'organisation', 'action' => 'notifications', 'latest')); ?>" />